import re

import requests

from 政务网.调度系统.按区划配置乡村医保调度 import coo


class getID:
    cookies = coo.cookies
    headers = coo.headers
    ur = '59.215.206.188'
    dispatch = 'ddglzy'
    def getID(self, itemid, itemcode,version):




        # print(queryRe)

        url = 'http://{}/{}/dispatch/resourse/itemconfigure/itemshow?itemid={}&itemcode={}&version={}'.format(self.ur,self.dispatch,itemid, itemcode,version)

        x = requests.get(url, cookies=self.cookies, headers=self.headers).text
        match = re.findall(r'value="(.*?)"\s+name="id"', x)
        #print(x)

        if (match == ['']):

            # print(match,11111111)
            ids=itemid
        else:
            # print(match,22222222)
            ids=match[0]
        return ids
